<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

/**
 * 专家控制器
 */
class Expert extends AdminBase
{
    
      /**
     * 健康小屋列表，健康专家层面，显示自己所在的小屋列表
     */
    public function activityPlanList()
    { 

        //获取专家所在小屋列表
        //
        $dept_id=session('department_info')['id'];
        $list=$this->logicHealthroom->getHealthroomList(['hospital_id'=>$dept_id]);
        $this->assign('list', $list);
        
        return $this->fetch('healthroom_list');
    }
    
    /**
     * 工作计划列表
     */
    public function workplanList($room_id=0)
    {

        $this->assign('list', $this->logicActivity->getActivityList(['a.room_id'=> $room_id]));
        $this->assign('room_id',$room_id);

       $dlist=parse_config_array('activity_type');
       $this->assign('dlist',$dlist);

        return $this->fetch('workplan_list');
    }

    /**
     * 工作计划添加
     */
    public function workplanAdd($room_id = 0)
    {

        IS_POST && $this->jump($this->logicActivity->activityEdit($this->param));

        $this->assign('room_id',$room_id);
        $this->assign('professor_code',session('member_info')['username']);

        $dlist=parse_config_array('activity_type');
        $this->assign('activity_list',$dlist);

        return $this->fetch('workplan_add');
    }

    /**
     * 工作计划编辑
     */
    public function workplanEdit($id = 0,$room_id=0)
    {
        IS_POST && $this->jump($this->logicActivity->activityEdit($this->param));

        $dlist=parse_config_array('activity_type');
        $this->assign('activity_list',$dlist);

        $info = $this->logicActivity->getActivityInfo(['id' => $id]);
        $this->assign('info', $info);

        $this->assign('room_id', $room_id);
        $this->assign('id',$id);

        return $this->fetch('workplan_edit');
    }

    /**
     * 工作计划删除
     */
    public function workplanDel($id = 0)
    {

        $this->jump($this->logicActivity->ActivityDel(['id' => $id]));
    }

    /**
     * 专家近期工作计划列表
     */
    public function lastExpertActivityList()
    {
        $professor_code=session('member_info')['username'];
        $list=$this->logicActivity->getLastExpertActivityList($professor_code);    
        $this->assign('list',$list);
        $dlist=parse_config_array('activity_type');
        $this->assign('dlist',$dlist);
        return $this->fetch('last_expert_activity_list');
    }

    public function lastWorkplanEdit($id = 0,$room_id=0)
    {
        IS_POST && $this->jump($this->logicActivity->lastActivityEdit($this->param));

        $dlist=parse_config_array('activity_type');
        $this->assign('activity_list',$dlist);

        $info = $this->logicActivity->getActivityInfo(['id' => $id]);
        $this->assign('info', $info);

        $this->assign('room_id', $room_id);
        $this->assign('id',$id);

        return $this->fetch('last_workplan_edit');
    }

}
